<?php
/* @var $this GiangvienController */
/* @var $model Giangvien */
/* @var $form CActiveForm */
?>

<div class="wide form">
	<table class="tableSearch">
<?php $form=$this->beginWidget('CActiveForm', array(
	'action'=>Yii::app()->createUrl($this->route),
	'method'=>'get',
)); ?>
	
	<?php 
		$connection=Yii::app()->db;   // assuming you have configured a "db" connection
		$command=$connection->createCommand()
		->select('mangach,tenngach')
		->from('ngach')
		->query();
		$ngach= array();
		foreach($command as $row)
		{
			$ngach[$row['mangach']]=$row['tenngach'];
		}
		
		$commandDV=$connection->createCommand()
		->select('madonvi,tendonvi')
		->from('donvicongtac')
		->query();
		$donvi= array();
		foreach($commandDV as $rowDV)
		{
			//array_push($ngach,$row);
			$donvi[$rowDV['madonvi']]=$rowDV['tendonvi'];
		}
	?>
	<div class="row">
	<tr>
		<td style="width:20%"><?php echo $form->label($model,'tengv'); ?></td>
		<td><?php echo $form->textField($model,'tengv',array('maxlength'=>128,'width'=>'100px')); ?></td>
		<td></td>
		<td style="float:right"><?php echo $form->label($model,'mangach'); ?></td>
		<td><?php echo $form->dropDownList($model,'mangach',$ngach,array('empty'=>'')); ?></td>
	</tr>
	</div>

	<div class="row">
	<tr>
		<td><?php echo $form->label($model,'chucdanhhocvi'); ?></td>
		<td><?php echo $form->dropDownList($model,'chucdanhhocvi',array(0=>'Cử nhân',1=>'Thạc sĩ',2=>'Tiến sĩ',3=>'Phó Giáo sư',4=>'Giáo sư'),array('empty'=>'')); ?></td>
		<td></td>
		<td style="float:right"><?php echo $form->label($model,'madonvi'); ?></td>
		<td><?php echo $form->dropDownList($model,'madonvi',$donvi,array('empty'=>'')); ?></td>
	</tr>
	</div>
	
	<?php 
		//$connection=Yii::app()->db;   // assuming you have configured a "db" connection
		
	?>
	
	<div class="row buttons">
		<tr>
		<td></td>
		<td><?php echo CHtml::submitButton('Tìm kiếm',array('id'=>'btnTim')); ?></td>
		<td></td>
		<td></td>
		<td></td>
		</tr>
	</div>
	</table>
<?php $this->endWidget(); ?>

</div><!-- search-form -->